Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fast/warm-reboot] add cpufreq.default_governor=performance to BOOT_OPTIONS #88

Closed
wants to merge 1 commit into from

Conversation

stepanblyschak
Copy link
Owner

@stepanblyschak stepanblyschak commented Jul 18, 2024

What I did

Set cpufreq.default_governor to performance for faster boot time. We observe consistent 1 sec improvement across several devices.

NOTE: This will apply to upgrades starting from 202405 since this is set in shutdown path to avoid any extra scripts running at boot time. Upgrade from older versions/branches will require a runtime patch to fast-reboot and warm-reboot script.

How I did it

Append this option to BOOT_OPTIONS variable.

How to verify it

Run fast-reboot or warm-reboot. Check:

admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
performance

After boot is finalized check that it is reset back to default:

admin@sonic:~$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
schedutil

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@stepanblyschak stepanblyschak changed the title [fast/warm-reboot] add cpufreq.default_governor=erformance to BOOT_OP… [fast/warm-reboot] add cpufreq.default_governor=performance to BOOT_OPTIONS Jul 18, 2024
…PTIONS

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>

# Set governor to performance to speed up boot process.
# The governor is reset back to kernel default in warmboot-finalizer script.
BOOT_OPTIONS="${BOOT_OPTIONS} cpufreq.default_governor=performance"
Copy link

@nazariig nazariig Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stepanblyschak let's add another check here:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
to make sure performance is really supported by CPU.
If not - log a relevant message and fallback to default

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nazariig governor is not a cpu feature, governor talks to the scaling driver (cpu specific) to set a target. scaling_available_governors - This list appears to be formed from the global cpufreq_governor_list in the cpufreq driver, where all governors that are included in the kernel are registered.

This cmdline param is fairly new (>5.9) but it is very appealing to use in this case (no need to wait for user space and sysfs to be available to set the governor from user space).

When this won't work - if the next kernel is not built with performance governor as a builtin driver it won't work (governor will not change).
For that, we would have to extract the kernel config from the next image rather then checking current image scaling_available_governors. And I generally don't think we would ever remove features from kernel in next releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants